package com.booktrade.mapper;

import com.booktrade.entity.Orders;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 订单表，存储用户购买的订单信息 Mapper 接口
 * </p>
 */
public interface OrdersMapper extends BaseMapper<Orders> {

    /**
     * 根据买家ID查询订单
     */
    @Select("SELECT * FROM orders WHERE buyer_id = #{buyerId}")
    List<Orders> selectByBuyerId(@Param("buyerId") Integer buyerId);

    /**
     * 根据卖家ID查询订单
     */
    @Select("SELECT * FROM orders WHERE seller_id = #{sellerId}")
    List<Orders> selectBySellerId(@Param("sellerId") Integer sellerId);
}
